import { useDark } from '@vueuse/core';
const isDark = useDark();

const baseStype = (color: string, lineColor: string, lineWidth?: number, labelStyle?: any | undefined) => {
  return {
    Symbol: '',
    color: color,
    lineWidth: lineWidth,
    lineColor: lineColor,
    // 图形透明度。支持从 0 到 1 的数字，为 0 时不绘制该图形。
    opacity: 1,
    labelStyle: labelStyle !== undefined ? labelStyle : {
      color: isDark.value ? '#ffffff' : '#2D2D2D',
      fontSize: 15
    }
  }
}

export const style = (appName: string): any => {
  if (appName.toLowerCase() === 'backend-bsms') {
    return isDark.value ? baseStype("#6079DF85", "#6079DFBA", 2) : baseStype("#6079DF85", "#6079DFBA", 2);
  }
  if (appName.toLowerCase() === 'backend-blog') {
    return isDark.value ? baseStype("#8b624f", "#8B624FAB", 2) : baseStype("#E88A328D", "#E88A328D", 2);
  }
  if (appName.toLowerCase() === 'expand-gateway') {
    return isDark.value ? baseStype("#00861081", "#008610CF", 2) : baseStype("#00861081", "#008610CF", 2);
  }
  return isDark.value ?
    baseStype("#5252527F", "#0F0F0F", 1, {
      color: '#555555',
      fontSize: 13
    }) :
    baseStype("#ECECEC82", "#ECECECBB", 1, {
      color: '#808080',
      fontSize: 13
    });
}